﻿using FluentNHibernate.Mapping;
using ContactCenter.Core.DomainModel;

namespace ContactCenter.Persistence.NH.Mapping
{
    public sealed class AddressMap : ClassMap<Address>
    {
        public AddressMap()
        {
            Table("CC_Customer_AddressBook");

            DynamicInsert();
            DynamicUpdate();

            Id(x => x.AddressId, "AddressId").GeneratedBy.HiLo("1000");
            References(x => x.Customer)
                .Column("CustomerId")
                .Not.Nullable();
            Map(x => x.Street);
            Map(x => x.PostalCode);
            Map(x => x.City);
            Map(x => x.Region);
        }
    }
}
